/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package library.ucm;

import javax.swing.JTextField;
import library.model.PswTable_ModelLIB;
import library.model.UserID_ModelLIB;
import library.model.UserPsw_ModelLIB;
import library.view.MainTableLIB;
import library.view.PswTableLIB;

/**
 *
 * @author I'm kevin
 */

public class UserCardInputLIB {

    private static UserCardInputLIB uci;
    private String id;
    private String password;
    private PswTableLIB pt;
    private JTextField psw;
    private MainTableLIB mt;
//    private JButton ok;
//    private MainTableLIB mt;

    public UserCardInputLIB() {
    }

    public UserCardInputLIB(MainTableLIB mt) {
        UserID_ModelLIB um = mt.getIDModel();
        id = um.getUserID();
    }

    public static UserCardInputLIB getInstance(MainTableLIB mt) {
        if (uci == null) {
            uci = new UserCardInputLIB();
            uci.id = mt.getIDModel().getUserID();
        }
        else{

            uci.id = mt.getIDModel().getUserID();
        }
        return uci;
    }

    public int run() {
        System.out.println("id: "+id);
        if (id.length() != 10) {
            return -1;
        } else {
                pt = PswTableLIB.getInstance(id);
//                PswTable_ModelLIB ptm = pt.getPswTable_Model();
////                psw = ptm.getPsw();
//                UserPsw_ModelLIB upm = pt.getUserPsw_Model();
//                password=upm.getPsw();

//                ok.addActionListener(new java.awt.event.ActionListener() {
//
//                    public void actionPerformed(java.awt.event.ActionEvent evt) {
//                        MsgSender.getInstance().toLibVerify(id, psw.getText());
//                        pt.setVisible(false);
//                    }
//                });

//                cancel.addActionListener(new java.awt.event.ActionListener() {
//
//                    public void actionPerformed(java.awt.event.ActionEvent evt) {
//
//                    }
//                });
            }
        return 0;
    }
}
